<template>
  <div>
    <div class="page">
      <span style="width:140px;">
        <b>完成年份</b>
        <el-date-picker
          v-model="year"
          type="year"
          size="small"
          placeholder="选择年"
          style="width:134px"
          value-format="yyyy"
          :picker-options="pickerOptions0"
          @change="selectTear()"
        >
        </el-date-picker>
      </span>
      <span style="width:120px;" class="striping">
        <i></i>
        <b>完成季度</b>
        <el-select v-model="quarter" size="small" placeholder="请选择">
          <el-option
            v-for="item in quarterList"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          >
          </el-option>
        </el-select>
      </span>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      year: "", //年,
      quarter: "", //季度
      quarterList: "", //季度数组
      pickerOptions0: {
        disabledDate(time) {
          return time.getTime() < Date.now() - 8.64e7;
        }
      },
    };
  },
  methods: {
    // 接受年
    selectTear() {
      console.log(this.year);
      if (this.year == this.doHandleYear()) {
        console.log("当前年");
      } else {
        console.log("明年");
      }
      console.log(this.doHandleYear());
    },
    // 获取当前年份
    doHandleYear(tYear) {
      var myDate = new Date();
      var tYear = myDate.getFullYear();
      return tYear;
    }
  }
};
</script>

<style lang="less" scoped>
.page {
  width: 100%;
  padding-left: 40px;
  position: relative;
  //   margin-bottom: 10px;
  > span {
    display: block;
    float: left;
    width: 300px;
    > b {
      display: block;
      width: 100%;
      height: 26px;
      line-height: 20px;
      font-size: 14px;
      padding-left: 10px;
    }
  }
  > span.striping {
    position: relative;
    left: 16px;
    > i {
      position: absolute;
      left: -17px;
      top: 43px;
      width: 10px;
      height: 1px;
      border-top: 1px solid #ccc;
    }
  }
}
</style>
